package leetcodecompetition.S102;

public class T6334 {
    public long[] findPrefixScore(int[] nums) {
        int n = nums.length;
        int max = nums[0];
        long [] res=new long[n];
        for (int i = 0; i < n; i++) {
            max = Math.max(max, nums[i]);
            nums[i] += max;
        }
        res[0]=nums[0];
        for (int i = 1; i < n; i++) {
            res[i]=res[i-1]+nums[i];
        }
        return res;
    }
}
